package com.foosun.core.exception;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Nelin on 14-3-2.
 */

@Component
public class ExceptionHandler implements HandlerExceptionResolver {
    @Override
    public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse httpServletResponse, Object o, Exception e) {
        e.printStackTrace();
        System.err.println("--------------------------------------");
        request.setAttribute("errosMsg", e.getMessage());
        return new ModelAndView("/common/exception");
    }
}
